package com.bosssoft.trainee.nontax.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bosssoft.trainee.nontax.common.Result;
import com.bosssoft.trainee.nontax.entity.po.Words;
import com.bosssoft.trainee.nontax.mapper.WordsMapper;
import com.bosssoft.trainee.nontax.service.IWordsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author MaYunFei
 * @ProjectName RBAC_BOSS
 * @Description TODO
 * @time 2022/6/13 16:20
 */
@Service
public class WordsImpl extends ServiceImpl<WordsMapper, Words> implements IWordsService {

    @Resource
    private WordsMapper wordsMapper;

    @Override
    public Result<?> findPage(Integer pageNum, Integer pageSize) {
        LambdaQueryWrapper<Words> query = Wrappers.<Words>lambdaQuery().orderByDesc(Words::getId);
        return Result.success(wordsMapper.selectPage(new Page<>(pageNum, pageSize), query));
    }
}
